var WxParse = require("../../wxParse/wxParse.js")
Page({
    data: {
        teacher: [],
        teacher_text: []
    },
    onLoad: function (t) {

        getApp().page.onLoad(this, t), t.mch_id && (this.setData({
            mch_id: t.mch_id
        }), this.getShopData());
    },
    onShow: function () {
        getApp().page.onShow(this);
    },
    getIndexData: function (list){
        var that = this;
        that.handleGoods(list,'teacher_text')
    },
    handleGoods: function (t,texta){
        var that = this;
        for (let a = 0; a < t.length; a++) {
            WxParse.wxParse('sketch'+a,'html',t[a].detail,that,5)
            if(a===t.length-1){
                WxParse.wxParseTemArray(texta,'sketch',t.length,that)
            }
            
        }
    },
    getShopData: function () {
        var a = this;
        getApp().core.showLoading({
            title: "加载中"
        }), getApp().request({
            url: getApp().api.mch.teacher_detail,
            data: {
                mch_id: a.data.mch_id
            },
            success: function (t) {
                if (0 == t.code) {
                    // var data = res.data.list;
                    // 就是下面这个for循环
                    // for (let i = 0; i < data.length; i++) {
                    // WxParse.wxParse('content_main' + i, 'html', data[i].detail, that);
                    // if (i === data.length - 1) {
                    //     WxParse.wxParseTemArray("WxParseListArr", 'content_main', data.length, that)
                    // }
                    // }

                    // a.setData({
                    //     teacher: data,
                    // });
                    a.setData({
                        teacher: t.data.list
                    }),a.getIndexData(a.data.teacher);
                }
                console.log(a.data.teacher)
            },
            complete: function () {
                getApp().core.hideLoading(), a.setData({
                    loading: !1
                });
            }
        });
    }
    
});